class EpisodeInfo(object):
  def __init__( self
              , series_name    = None
              , series_number  = None
              , episode_number = None
              , parent         = None
              ):
    if parent:
      self.series_name     = parent.series_name
      self.series_number   = parent.series_number
      self.episode_number  = parent.episode_number
    else:
      self.series_name = series_name
      self.series_number = series_number
      self.episode_number = episode_number

  def __repr__(self):
    return "%s S%dE%d" % ( self.series_name
                         , self.series_number
                         , self.episode_number
                         )

  def __eq__(self, other):
    conditions = []
    conditions.append(self.series_name.lower() == other.series_name.lower())
    conditions.append(self.series_number == other.series_number)
    conditions.append(self.episode_number == other.episode_number)
    return all(conditions)


class EpisodeDetails(EpisodeInfo):
  title = "Unknown Title" 
  synopsis = "No Synopsis" 
  runtime = None
  filepath = None
  extra_info = {}

  def __repr__(self):
    return "%s - %s" % ( EpisodeInfo.__repr__(self)
                       , self.title
                       )

  def __str__(self):
    output = self.__repr__() + '\n'
    output += self.synopsis + '\n'
    for key in self.extra_info:
      output += key + ' ---> ' + self.extra_info[key] + '\n'
    return output 

 
